package com.wanxi.test;

import java.util.Scanner;
//一维数组，键入数据的最大值
public class ScannerOneArray {
    public static void main(String[] args) {
        int[] array = new int[7];
        int length = array.length;
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入7个数据");

        for (int i = 0; i < length; i++) {
            System.out.print("第" + (i + 1) + "个数据是: ");
            array[i] = scanner.nextInt();
        }
        int max = 0;

        for (int i = 0; i < length; i++) {
            max = max > array[i] ? max : array[i];
        }

        System.out.println("最大的数据是：" + max);

        scanner.close();

    }
}
